home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / gamesmaster / demosrc / widescreen.s < prev    next >
Text File  |  1996-07-16  |  4KB  |  142 lines

  1. ;Horizontal Scroll 640
  2. ;---------------------
  3. ;This opens an extra wide screen of 256x640 pixels, and hardware scrolls
  4. ;left and right.  This is *totally* inadequate for platformers, shoot'em-ups
  5. ;etc because the picture size takes up huge amounts of memory.  However for
  6. ;games like Skidmarks, Lemmings, Monkey Island, etc, such large screens can
  7. ;be a necessity.
  8.  
  9.     opt    o+
  10.  
  11.     INCLUDE    "exec/exec_lib.i"
  12.     INCLUDE    "games/games_lib.i"
  13.     INCLUDE    "games/games.i"
  14.  
  15. CALL    MACRO
  16.     jsr    _LVO\1(a6)
  17.     ENDM
  18.  
  19. LOCAL    =    1
  20.  
  21.     SECTION    "ExtraLarge640",CODE
  22.  
  23. ;===========================================================================;
  24. ;                             INITIALISE DEMO
  25. ;===========================================================================;
  26.  
  27. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  28.     move.l    ($4).w,a6
  29.     lea    GMS_Name(pc),a1
  30.     moveq    #$00,d0
  31.     CALL    OpenLibrary
  32.     move.l    d0,GMS_Base
  33.     beq    Quit
  34.  
  35.     move.l    GMS_Base(pc),a6          ;Tell GMS that we want to add a
  36.     CALL    SetUserPri
  37.  
  38.     lea    ScreenStruct(pc),a0      ;screen for use.
  39.     CALL    Add_Screen
  40.     tst.l    d0
  41.     bne.s    Error
  42.  
  43.     move.l    SS_MemPtr1(a0),a1        ;Destination = SS_MemPtr1.
  44.     lea    PackedPicFile(pc),a0     ;File Name.
  45.     CALL    QuickLoad
  46.     tst.l    d0
  47.     beq.s    Error
  48.  
  49.     lea    ScreenStruct(pc),a0      ;Unpack the data on top of itself.
  50.     move.l    SS_MemPtr1(a0),a1
  51.     move.l    a1,a0
  52.     moveq    #$00,d0
  53.     CALL    SmartUnpack
  54.  
  55.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  56.     CALL    Show_Screen
  57.  
  58. ;===========================================================================;
  59. ;                                MAIN LOOP
  60. ;===========================================================================;
  61.  
  62. Loop:    CALL    Wait_OSVBL
  63.     tst.w    Direction
  64.     beq.s    .Right
  65.  
  66. .Left    cmp.w    #-16,SS_ScrollXCount(a0)
  67.     ble.s    .Right
  68.     move.w    #1,Direction
  69.     moveq    #-1,d0
  70.     bra.s    .scroll
  71.  
  72. .Right    cmp.w    #320-16,SS_ScrollXCount(a0)
  73.     bge.s    .Left
  74.     clr.w    Direction
  75.     moveq    #1,d0
  76. .scroll    CALL    HWScroll_Horizontal      ;Reposition_Screen
  77.  
  78. .done    moveq    #JPORT1,d0               ;Port 1 (Mouse)
  79.         moveq   #JT_SWITCH,d1
  80.         CALL    Read_JoyPort
  81.     btst    #JS_FIRE1,d0
  82.     beq.s    Loop
  83.  
  84. ;===========================================================================;
  85. ;                              RETURN TO DOS
  86. ;===========================================================================;
  87.  
  88.     CALL    Delete_Screen    ;Give back screen memory etc.
  89. Error    move.l    GMS_Base(pc),a1
  90.     move.l    ($4).w,a6
  91.     CALL    CloseLibrary
  92. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  93.     moveq    #$00,d0
  94.     rts
  95.  
  96. ;===========================================================================;
  97. ;                                  DATA
  98. ;===========================================================================;
  99.  
  100. Direction:
  101.     dc.w    0
  102.  
  103. GMS_Name:
  104.     dc.b    "games.library",0
  105.     even
  106. GMS_Base:
  107.     dc.l    0
  108.  
  109. AMT_PLANES =    4
  110.  
  111. ScreenStruct:
  112.     dc.l    "GSV1"
  113.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  114.     dc.l    0                        ;Child_Screen1
  115.     dc.l    ScreenPalette            ;Adr_Palette
  116.     dc.l    0                        ;Adr_Colour_List
  117.     dc.l    16                       ;Amt_Colours (dependent on planes)
  118.     dc.w    256,320,320/8            ;Screen Height/Width/ByteWidth 
  119.     dc.w    256,640,640/8            ;Picture Height/Width/ByteWidth
  120.     dc.w    AMT_PLANES               ;Amt_Planes
  121.     dc.w    0,0                      ;Top Of Screen, X/Y
  122.     dc.w    16/8                     ;Scroll buffer in pixels/8.
  123.     dc.w    0                        ;X offset (for hor. scrolling).
  124.     dc.w    0                        ;Y offset (for ver. scrolling).
  125.     dc.l    NOBURST                  ;Special attributes.
  126.     dc.w    LORES                    ;Screen mode.
  127.     dc.b    INTERLEAVED              ;Screen type
  128.     dc.b    0                        ;Screen Is Being Displayed?
  129.     dc.l    0,0                      ;Reserved area.
  130.     even
  131.  
  132. ScreenPalette:
  133.     dc.w    $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801
  134.     dc.w    $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880
  135.  
  136. PackedPicFile:
  137.     IFNE    LOCAL
  138.     dc.b    "GAMESLIB:"
  139.     ENDC
  140.     dc.b    "data/Pic640x256.pak",0
  141.     even
  142.